import 'dart:io';

import 'package:flutter/material.dart';
import 'package:lib_furnace/gesture_conflict/gesture_conflict_tracker.dart';

/// Author: Blake
/// Created: 2023-09-18
class GestureConflictWidget extends StatelessWidget {
  final Widget child;

  const GestureConflictWidget({super.key, required this.child});

  @override
  Widget build(BuildContext context) {
    if (Platform.isIOS) {
      return RawGestureDetector(
        behavior: HitTestBehavior.translucent,
        gestures: {
          GestureConflictTracker:
              GestureRecognizerFactoryWithHandlers<GestureConflictTracker>(
            () => GestureConflictTracker(),
            (instance) {
              instance
                ..onStart = (DragStartDetails details) {}
                ..onEnd = (detail) {};
            },
          ),
        },
        child: child,
      );
    }
    return child;
  }
}
